File name
Commit message
Commit date
File name
Commit message
Commit date
09-16
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
import type { Metadata } from 'next';
import { notFound } from 'next/navigation';
import { verifySession } from '@/lib/auth/dal';
import { fetchCommonCodes } from '@/lib/data/repositories/common-code-repository';
import { fetchMerchantDetail } from '@/lib/data/repositories/merchant-detail-repository';
import { fetchMerchantProducts } from '@/lib/data/repositories/merchant-product-repository';
import { CODE_GROUP } from '@/lib/domain/common-code';
import { MerchantDetailForm } from './_components/merchant-detail-form';
export const metadata: Metadata = { title: '가맹몰 상세 정보' };
export const dynamic = 'force-dynamic';
interface PageProps {
params: Promise<{ frcsNo: string }>;
}
/** 가맹점 하나의 상세 화면 — 상세가 아직 없으면 그 가맹점을 고정한 채 처음 만드는 화면이 된다. */
export default async function Page({ params }: PageProps) {
await verifySession();
const { frcsNo } = await params;
const detail = await fetchMerchantDetail(frcsNo);
if (!detail) {
notFound();
}
// 상세가 없으면 백엔드 메뉴 목록도 비어 온다(상세와 INNER JOIN) — 부르지 않는다.
const [products, categories] = await Promise.all([
detail.hasDetail ? fetchMerchantProducts(frcsNo) : Promise.resolve([]),
fetchCommonCodes(CODE_GROUP.merchantType),
]);
return (
<MerchantDetailForm
merchant={detail}
detail={detail.hasDetail ? detail : undefined}
products={products}
categories={categories}
/>
);
}